/**
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: midi365 </p>
 */


package cn.midi365.train.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.midi365.train.common.ErrorCode;
import cn.midi365.train.entity.School;
import cn.midi365.train.service.SchoolService;

import com.eteam.common.entity.TeamContext;
import com.eteam.common.web.controller.BaseController;


@Controller
@RequestMapping("train/api/school")
public class SchoolController extends BaseController {
    private static Logger logger = LoggerFactory.getLogger(SchoolController.class);
    
    @Autowired
    private  SchoolService  schoolService;
    
    @RequestMapping("/add")
    public void addSchool(HttpServletRequest request, HttpServletResponse response, School school ) {
        TeamContext context = BaseController.getContext(request);
        try {
            
            schoolService.save(school , context);
           
        } catch (Exception e) {
            logger.error("sequence:{}加载失败 ", context, e);
            this.sendFailureMessage(response, ErrorCode.INPUT_PARAMS_ERROR, "加载失败");
        }
    }

   

}
